package com.prs.crm.action.sys;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.domain.sys.PointLoginManager;
import com.prs.crm.service.sys.PointLoginManagerService;

public class PointLoginManagerAction extends BaseAction{

	private static final long serialVersionUID = 1L;
	private Integer[] ids;
	private PaginationSupport pagination;
	private PointLoginManager pointLoginManager;
	private PointLoginManagerService pointLoginManagerService;
	public Integer[] getIds() {
		return ids;
	}
	public void setIds(Integer[] ids) {
		this.ids = ids;
	}
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	public PointLoginManager getPointLoginManager() {
		return pointLoginManager;
	}
	public void setPointLoginManager(PointLoginManager pointLoginManager) {
		this.pointLoginManager = pointLoginManager;
	}
	public PointLoginManagerService getPointLoginManagerService() {
		return pointLoginManagerService;
	}
	public void setPointLoginManagerService(
			PointLoginManagerService pointLoginManagerService) {
		this.pointLoginManagerService = pointLoginManagerService;
	}
	@Action("listPointLoginManager")
	public String listPointLoginManager(){
		DetachedCriteria criteria=this.getPaginationHelper().createQuery(PointLoginManager.class);
		pagination=this.getPaginationHelper().prepare(pagination);
		this.setPagination(this.getPointLoginManagerService().listByPage(criteria, pagination));
		return SUCCESS;
	}
	
	@Action("editPointLoginManager")
	public String editPointLoginManager(){
		if(ids!=null){
			this.pointLoginManager=this.getPointLoginManagerService().get(ids[0]);
		}
		return SUCCESS;
	} 
	@Action(value="savePointLoginManager",results={
			@Result(name="success",type="redirect",location="listPointLoginManager"),
			@Result(name="error",type="redirect",location="editPointLoginManager")
	})
	public String savePointLoginManager(){
		this.getPointLoginManagerService().save(pointLoginManager);
		return SUCCESS;
	}
	@Action(value="removePointLoginManager",results={
			@Result(name="success",type="redirect",location="listPointLoginManager"),
			@Result(name="error",type="redirect",location="listPointLoginManager")
	})
	public String removePointLoginManager(){
		if(ids!=null){
			this.pointLoginManager=this.getPointLoginManagerService().get(ids[0]);
		}
		this.getPointLoginManagerService().batchRemove(ids);
		return SUCCESS;
	}
}
